import pandas as pd
import streamlit as st

uploaded_file = st.file_uploader(
    "Choose a file",
    type=["pdf", "txt", "md", "docx", "csv", "xlsx", "pptx", "zip", "jpg", "png"],
)

if uploaded_file is None:
    st.stop()


@st.cache_data
def load_data(file):
    print("exec load_data")
    return pd.read_excel(file, None)


dfs = load_data(uploaded_file)

names = list(dfs.keys())
sheet_selects = st.multiselect("Select sheets", names, [])

if len(sheet_selects) == 0:
    st.stop()

tabs = st.tabs(sheet_selects)

for tab, name in zip(tabs, sheet_selects):
    with tab:
        df = dfs[name]
        st.dataframe(df)
